package modelLayer;

import java.util.ArrayList;
/**
 * Write a description of class CopyContainer here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class CopyContainer
{
    // instance variables - replace the example below with your own
    private ArrayList<Copy> copyList;

    /**
     * Constructor for objects of class CopyContainer
     */
    public CopyContainer()
    {
        copyList = new ArrayList<Copy>();
    }

    // Add a copy
    public void addCopy(Copy copy)
    {
        if(!copyList.contains(copy)) {
            copyList.add(copy);
        }
    }
    
    // Find a copy
    public Copy findCopy(String serialNumber)
    {
        Copy returnCopy = null;
        for(Copy copy : copyList)
        {
            if(copy.getSerialNumber().equals(serialNumber))
            {
                returnCopy = copy;
            }
            
        }
        return returnCopy;
    }
    
    // Delete a copy
    public void deleteCopy(Copy copy)
    {
        copyList.remove(copy);
    }
    
}
